/*
 *  ppm.h
 *  libCV
 *
 *  Created by Gregory Koch on 05/03/11.
 *  Copyright 2011 IFlyBotIV. All rights reserved.
 *
 */

#ifndef __PPM_H__
#define __PPM_H__

#include "libCV.h"

#define MAX_LINE   80

#define PPM_GREYSCALE  "P2"
#define PPM_COLOR      "P3"
#define PPM_BINARY     "P2"

typedef struct ppm_s
{
	char magic_number[MAX_LINE];
	unsigned int height;
	unsigned int width;
	unsigned int max_val;
	unsigned char *datas;
} ppm_t;


ppm_t init_ppm(char* magic_number, unsigned char* datas, cvSize_t size);

void free_ppm(ppm_t ppm);

ppm_t read_ppm(char *file);

void write_ppm(ppm_t ppm, char *file);

void write_image2ppm(image_t img, char *file);

void write_zone2ppm(zone_t zone, image_t img, char *file);

#endif /* __PPM_H__ */
